import {request} from './index'

// 根据token获取用户info
export function getUserInfo(){
  return request({
    url:'/users/info',
    method:'get'
  })
}

export function login(username, password) {
  return request({
    url: '/users/login',
    method: 'post',
    data: {
      username,
      password
    }

  })
}

export function register(username, password, secreSecurity, secreSecurityAnswer) {
  return request({
    url: '/users/register',
    method: 'post',
    data: {
      username,
      password,
      secreSecurity,
      secreSecurityAnswer
    }

  })
}

// 找回密码

// 根据用户username获取用户的密保问题
export function getUserSecretSecurity(username) {
  return request({
    method: 'get',
    url: '/users/secretSecurity',
    params: {username}
  })
}

// 改密
export function changePassword({username,newPassword}) {
  return request({
    method: 'post',
    url: '/users/changePassword',
    data:{username,newPassword}
  })
}